File Class Reference

Inheritance diagram for File:
Resource

List of all members.

Public Member Functions

 setOrigFileName ($origFileName)
 getOrigFileName ()
 setType ($type)
 getType ()
 getSize ()
 setSize ($size)
 setCounter ($counter)
 setExtension ($extension)
 getExtension ()
 getPathToFile ()
 isFileVisible ()
 getHTMLString ($statisticView=false, $cssClass="")
 getFileOptionHTML ($option)
 archiverAccept (ResourceVisitor $visitor, $parentPath="/")

Protected Member Functions

 getContent ($url)

Protected Attributes

 $origFileName
 $type
 $size
 $counter
 $extension

Private Member Functions

 getUserIcons ()
 getFaviconUrl ($url)
 remoteFileExists ($url)
 getCopyFileHTML ()
 getFileLink ()
 getStatisticLink ()
 getDownloadCount ()
 getDownloadStatisticHTML ()
 getDeleteFileHTML ()
 getDescriptionHTML ()
 getStatisticHTML ()

Detailed Description

Definition at line 32 of file class.file.inc.php.


Member Function Documentation

File::archiverAccept ( ResourceVisitor visitor,
parentPath = "/" 
)

Archiver accept method for ArchiveVisitor

Parameters:
ArchiveVisitor $visitor
String $parentPath Parent path
Returns:
Sting Parent path

Definition at line 533 of file class.file.inc.php.

References ResourceVisitor::visit().

00533                                                                                 {
00534         assert($visitor instanceof ResourceVisitor);
00535         
00536         return $visitor->visit($this, $parentPath);
00537     }

File::getContent ( url  )  [protected]

Definition at line 148 of file class.file.inc.php.

Referenced by getFaviconUrl().

00149         {
00150                 $session = curl_init();
00151                 curl_setopt($session, CURLOPT_URL, $url);
00152                 curl_setopt($session, CURLOPT_HEADER, false);
00153                 curl_setopt($session, CURLOPT_RETURNTRANSFER, true);
00154                 curl_setopt($session, CURLOPT_CONNECTTIMEOUT, 6);
00155         curl_setopt($session, CURLOPT_TIMEOUT, 6);
00156         
00157                 $response = curl_exec($session);
00158                 if (curl_errno($session)!=0) $response = null;
00159         
00160                 curl_close($session);
00161                 return $response;
00162         }

File::getCopyFileHTML (  )  [private]

Definition at line 361 of file class.file.inc.php.

References $_SESSION, Resource::$fileID, and RessourcenDB::getUserCourses().

Referenced by getFileOptionHTML().

00361                                            {
00362                         $template = new Template(PATH_TO_ROOT . "/ressourcen/templates/copyfile.html");
00363                         $courses = RessourcenDB::getUserCourses( $_SESSION['userid'] );
00364             $currentCourse = 0;
00365             $courseOptions = "";
00366             if ( $_SESSION['course'] != 0 ) {
00367                 $courseOptions .= "<option value='0'>Foyer</option>\n";
00368             }
00369             foreach($courses as $course) {
00370                 if ($currentCourse == $course->ID) {
00371                          $courseOptions .= ", ".Data::toHTML($course->ShortName, false);
00372                 } else {
00373                     if ($currentCourse != 0)  $courseOptions .= ")</option>\n";
00374                     $courseOptions .= "<option value='".$course->ID."'";
00375                     $courseOptions .= ">".Data::toHTML($course->SN." (".$course->ShortName, false);
00376                     $currentCourse = $course->ID;
00377                 }
00378             }
00379             $courseOptions .= ")</option>\n";
00380                         $folderID = $this->fileManager->getActiveFolder();
00381                         $fileID = $this->fileID;
00382                         $html = "";
00383                         eval ( $template->getTemplate( "html" ) );
00384                         return $html;
00385         }

File::getDeleteFileHTML (  )  [private]

Definition at line 427 of file class.file.inc.php.

References Resource::$fileID.

Referenced by getFileOptionHTML().

00427                                              {
00428                         $template = new Template(PATH_TO_ROOT . "/ressourcen/templates/deletefile.html");
00429                         $folderID = $this->fileManager->getActiveFolder();
00430                         $fileID = $this->fileID;
00431                         $html = "";
00432                         eval ( $template->getTemplate( "html" ) );
00433                         return $html;
00434         }

File::getDescriptionHTML (  )  [private]

Definition at line 436 of file class.file.inc.php.

Referenced by getFileOptionHTML().

00436                                               {
00437         $bbcode = new BBCode();
00438         if (!$this->description) $this->description = "Keine Beschreibung vorhanden";
00439         return "<tr><td class='res_file-extra' colspan='6'>".$bbcode->parse($this->description) ."</td></tr>";
00440         }

File::getDownloadCount (  )  [private]

Definition at line 405 of file class.file.inc.php.

References $db.

Referenced by getDownloadStatisticHTML().

00405                                             {
00406         global $db;
00407         if ($this->courseID == 0) {
00408             $count = (int) $db->get_var("SELECT DISTINCT count(filelog.userID) FROM filelog LEFT JOIN user ON (filelog.userID=user.ID) WHERE fileID='".$this->fileID."' AND filelog.userID!=1 group BY fileID");
00409         } else {
00410             $count = (int) $db->get_var("SELECT DISTINCT count(filelog.userID) FROM filelog LEFT JOIN user_course ON (filelog.userID=user_course.userID) WHERE fileID='".$this->fileID."' AND filelog.userID!=1 AND user_course.courseID='".$this->courseID."' group BY fileID");
00411         }
00412         return $count;
00413         }

File::getDownloadStatisticHTML (  )  [private]

Definition at line 415 of file class.file.inc.php.

References $db, and getDownloadCount().

Referenced by getHTMLString().

00415                                                     {
00416                 global $db;
00417                 $downloadCount = $this->getDownloadCount();
00418                 if ($this->courseID == 0) {
00419                 $allCount = $db->get_var("SELECT COUNT(*) FROM user WHERE ID!=1");
00420          } else {
00421             $allCount = $db->get_var("SELECT COUNT(*) FROM user_course WHERE courseID='".$file->courseID."' AND userID!=1");
00422          }
00423          return " (".$downloadCount."/".$allCount.")";
00424         }

File::getExtension (  ) 

Getter for File extension property.

Returns:
String Extenstion

Definition at line 76 of file class.file.inc.php.

Referenced by ZipVisitor::visitFile(), and ZipVisitor::visitLink().

00076                                         {
00077                 return $this->extension;
00078         }

File::getFaviconUrl ( url  )  [private]

Ermittelt den Pfad für das Favicon einer Webseite

Parameters:
string [$url] Die Adresse wo das Favicon gesucht werden soll
Returns:
string FaviconUrl public

Definition at line 173 of file class.file.inc.php.

References getContent().

Referenced by getHTMLString().

00173                                          {
00174         if (strstr($url, "ftp://")) return false;
00175         // Bei https-Links nur im http-Pendant suchen, da sonst eventuell Zertifikatsmeldungen angezeigt werden
00176         $url = str_replace("https://", "http://", $url);
00177         $file = $this->getContent($url);
00178         if (is_null($file)) return false;
00179         $lines = explode( "\n", $file );
00180         $tag = $RT = $return = array();
00181         foreach ( $lines as $line ) {
00182             /* This only works if the title and its tags are on one line */
00183             if (eregi("<link(.*)>", $line, $tag)) if (eregi(".*rel=\"SHORTCUT ICON\" (.*)", $tag[1], $RT) || eregi(".*rel=\"icon\" (.*)", $tag[1], $RT)) if (eregi(".*href=\"([^=]*)\"", $RT[1], $return)) break;
00184         }
00185 
00186         if (isset($return[1])) return $return[1];
00187         return false;
00188     }

File::getFileLink (  )  [private]

Definition at line 387 of file class.file.inc.php.

Referenced by getHTMLString().

00387                                        {
00388         if ($this->type == 'file') {
00389             $LINK = "<a class='file' href='".$this->createLink(0, array("activeFolder" => $this->fileManager->getActiveFolder(), "action" => 'get'.$this->type, 'actionID' => $this->fileID)) ."' title='Dateiname: ".Data::toHTML($this->origFileName, false) ."'>";
00390         } elseif ($this->type == 'link') {
00391             $LINK = "<a class='file' href='".$this->createLink(0, array("activeFolder" => $this->fileManager->getActiveFolder(), "action" => 'get'.$this->type, 'actionID' => $this->fileID)) ."' title='URL: ".Data::toHTML($this->link, false) ."'>";
00392         }
00393         return $LINK;
00394         }

File::getFileOptionHTML ( option  ) 

Definition at line 345 of file class.file.inc.php.

References getCopyFileHTML(), getDeleteFileHTML(), and getDescriptionHTML().

Referenced by getHTMLString().

00345                                                      {
00346                 switch ( $option ) {
00347                         case "deleteFile":
00348                                 return $this->getDeleteFileHTML();
00349                         case "copyFile":
00350                                 return $this->getCopyFileHTML();
00351                         case "infoFile":
00352                                 return $this->getDescriptionHTML();
00353                         case "setRessourceVisibility":
00354                                 return  "<tr><td colspan='5'>"
00355                                                 .$this->getRessourceVisibilityHTML()
00356                                                 ."</td></tr>";
00357                 }
00358                 return "";
00359         }

File::getHTMLString ( statisticView = false,
cssClass = "" 
)

Definition at line 224 of file class.file.inc.php.

References $_SESSION, Resource::$courseID, $db, getDownloadStatisticHTML(), getFaviconUrl(), getFileLink(), getFileOptionHTML(), getStatisticHTML(), getStatisticLink(), getUserIcons(), and remoteFileExists().

00224                                                                                 {
00225                 $templateTableRow = ( $statisticView ) ?
00226                 new Template( PATH_TO_ROOT . "/ressourcen/templates/filelist_entry_statistic.html" )
00227                 : new Template( PATH_TO_ROOT . "/ressourcen/templates/filelist_entry.html" );
00228 
00229         $activeFolder = $this->fileManager->getActiveFolder();
00230         $action = $this->fileManager->getAction();
00231         $actionID = $this->fileManager->getActionID();
00232                 $imgFolder = $this->fileManager->getImgFolder();
00233 
00234                 global $VISIBLE_ICONS;
00235 
00236         if (($_SESSION['usergroup'] == STUDENT && $this->visibleType != 1 && $_SESSION['userid'] != $this->userID)) {
00237             // Wenn Tutor oder Student und darf nicht sehen spezielle DB abfragen
00238             if (!isset($_SESSION["assistent"]) || (isset($_SESSION["assistent"]) && $this->visibleType == 3 && $_SESSION['userid'] != $this->userID)) {
00239                 $visible = $db->get_var("SELECT count(*) FROM filevisible WHERE userID='".$_SESSION['userid']."' AND fileID='".$this->fileID."'");
00240                 if ($visible < 1) continue;
00241             }
00242         }
00243         $CELL = $cssClass;
00244         // Symbole
00245 
00246                 global $db;
00247         $user = $db->get_row("SELECT Vorname, Nachname, gender FROM user WHERE ID='".$this->userID."'");
00248         
00249         // Username inkl Gruppennamen anzeigen
00250                 $courseID = $_SESSION["course"];
00251                 $groupName = UserTools::getUserGroupName($this->userID, $courseID);
00252                 $userName = $user->Vorname . " " . $user->Nachname . " ($groupName)";         
00253         
00254         // Zeigt wenn vorhanden ein Extension basierendes Icon an (extension.gif/png (einzige mit Transparenz)) im Ordner ressourcen/icons/filetypes
00255         // BZW Standardfiles fuer Link und Dateien
00256         $fileTypeImage = $imgFolder."filetypes/";
00257         if ($this->type == "link") {
00258             $fileTypeImage.= "link.gif";
00259             // Prueft ob ein favicon vorhanden ist, und zeigt dann dieses als Symbol an.
00260             $url = @parse_url($this->link);
00261             if ($url['scheme'] == '') $url['scheme'] = "http";
00262             if ($url['host'] != '') {
00263                 if ($this->remoteFileExists($url['scheme']."://".$url['host']."/favicon.ico")) {
00264                     $fileTypeImage = $url['scheme']."://".$url['host']."/favicon.ico";
00265                 } elseif ($favicon = $this->getFaviconUrl($url['scheme']."://".$url['host'])) {
00266                     $urlTest = @parse_url($favicon);
00267                     if (isset($urlTest['scheme']) && $urlTest['scheme'] == '') $favicon = $url['scheme']."://".$url['host'].'/'.$favicon;
00268                     if ($this->remoteFileExists($favicon)) $fileTypeImage = $favicon;
00269                 }
00270             }
00271         } elseif ($this->type == "file") {
00272             if (file_exists($imgFolder."filetypes/".$this->extension.".gif")) $fileTypeImage.= $this->extension.".gif";
00273             elseif (file_exists($imgFolder."filetypes/".$this->extension.".png")) $fileTypeImage.= $this->extension.".png";
00274             else  {$fileTypeImage.= "file.gif";
00275             $this->extension = "file";} 
00276         }
00277         $IMG = "<img width='18' height='16' src='".$fileTypeImage."' alt='Dateisymbol' />";
00278 //Performance-Tuning: Image wird als CSS-Sprite geladen (deaktiviert, weil nicht alle Icons im CSS-Sprite enthalten)
00279 //        if($_SESSION["UserStyle"] != "fh_yaml")
00280 //              $IMG = "<img width='18' height='16' src='".$fileTypeImage."' alt='Dateisymbol' />";
00281 //        else {
00282 //              if ($this->type == "link") {
00283 //                      $IMG = "<img width='18' height='16' src='".$fileTypeImage."' alt='Dateisymbol' />";
00284 //              } else {
00285 //                      $IMG = "<img src='".PATH_TO_ROOT."images/transparent.gif' class='icon_extension_".$this->extension."' alt='Dateisymbol' />";
00286 //              }
00287 //        }
00288         // Fuer TOP20 wird angezeigt ob Kurs oder Foyer Datei.
00289         if ($activeFolder < 0 && $this->courseID == 0 && $_SESSION['course'] != 0) $this->name = "".$this->name."<span class='text10'><strong>&nbsp;&nbsp;(Foyer)</strong></span>";
00290 
00291         //########### Ist Zeile ausgewählt, dann markieren und Hover Effekt unterbinden
00292         if (isset($_GET['actionID']) && $_GET['actionID'] == $this->fileID) {
00293             $FILESELECT = 'res_fileselect';
00294             $FILE_CLASS = '';
00295         } else {
00296             $FILESELECT = '';
00297             $FILE_CLASS = 'res_file';
00298         }
00299         $FILE_NAME = Data::toHTML($this->name, false);
00300 
00301         if ($this->type == 'link') {
00302             $this->size = "Link";
00303         } else {
00304             $this->size = Format::FilesizeStr($this->size);
00305         }
00306 
00307                 $downloadStats = ( $statisticView ) ? $this->getDownloadStatisticHTML() : "";
00308                 $LINK = ( $statisticView ) ? $this->getStatisticLink() : $this->getFileLink();
00309 
00310         // Link auf BenutzerProfil
00311         $userLink = "<a href='".PATH_TO_ROOT."user/homepage.php?user=$this->userID'>".Data::toHTML("$userName", false) ."</a>";
00312         if ($role = RoleArtefacts::getRoleForItem(RESSOURCE, (int)$this->fileID)) {
00313             $userLink.= " (".$role->getPropertiesLink($role->getName($user->gender)) .")";
00314         }
00315         if ($team = TeamArtefacts::getTeamForItem(RESSOURCE, (int)$this->fileID)) {
00316             $userLink.= " (".Data::toHTML($team->getName(), false) .")";
00317         }
00318         $tableData = array();
00319         $tableData["resource"] = $LINK.$IMG. $FILE_NAME . $downloadStats . "</a>";
00320         if ( !$statisticView )$tableData["action"] = $this->getUserIcons();
00321                 $tableData["size"] = $this->size;
00322                 $tableData["created"] = Output::echoDate("d.m.Y H:i", (int)$this->createTime);
00323                 $tableData["owner"] = $userLink;
00324                 $tableData["clicks"] = $this->counter;
00325                 if ( $statisticView ) {
00326                         $courseCount = $db->get_var("SELECT count(*) FROM user_course ".($this->courseID == 0 ? "" : " WHERE courseID='".$this->courseID."' AND userID!=1"));
00327                         $klicks = $db->get_var("SELECT DISTINCT count(userID) FROM filelog WHERE fileID='".$this->fileID."' AND userID!=1 GROUP BY fileID");
00328             $prozent = sprintf("%3.2f%%", ($klicks*100) /$courseCount);
00329                         $tableData["clicks"] .= "/" . $prozent;
00330                 }
00331 
00332         $htmlString = "";
00333         eval( $templateTableRow->getTemplate("htmlString") );
00334         if ( $actionID == $this->fileID ) {
00335                 if ( $statisticView ) {
00336                         if ( $action == "showInfo" ) $htmlString .= $this->getStatisticHTML();
00337                 } else {
00338                         $htmlString .= $this->getFileOptionHTML( $action );
00339                 }
00340         }
00341 
00342                 return $htmlString;
00343         }

File::getOrigFileName (  ) 

Definition at line 43 of file class.file.inc.php.

00043                                           {
00044                 return $this->origFileName;
00045         }

File::getPathToFile (  ) 

Definition at line 80 of file class.file.inc.php.

Referenced by ZipVisitor::visitFile().

00080                                         {
00081                 global $settings;
00082             // Verzeichnis dass die hochgeladenen Dateien enthält
00083         $basedir = PATH_TO_ROOT.$settings["upload_path"].'filemanager/courseID/'.$this->courseID;
00084         //die datei wie sie auf dem server liegt (der dateiname ist verschlüsselt)
00085         $filename = sprintf("%s/%s", $basedir, $this->link);
00086                 return $filename;
00087         }

File::getSize (  ) 

Definition at line 55 of file class.file.inc.php.

00055                                   {
00056                 return $this->size;
00057         }

File::getStatisticHTML (  )  [private]

Definition at line 442 of file class.file.inc.php.

References $db.

Referenced by getHTMLString().

00442                                             {
00443                         global $db;
00444                         $CELL1 = $CELL = 'tableCellDark'; // AnfangsKlasse fuer Tabellenzeile, wechselt
00445                         $CELL2 = 'tableCell';
00446                                 $html = "";
00447 
00448                 if ($this->courseID == 0) {
00449                     $allCount = $db->get_var("SELECT COUNT(*) FROM user WHERE ID!=1");
00450                     $downCount = $db->get_var("SELECT DISTINCT count(userID) FROM filelog WHERE fileID='".$this->fileID."' AND userID!=1 GROUP BY fileID");
00451                 } else {
00452                     $allCount = $db->get_var("SELECT COUNT(*) FROM user_course WHERE courseID='".$this->courseID."' AND userID!=1");
00453                     $downCount = $db->get_var("SELECT DISTINCT count(filelog.userID) FROM filelog LEFT JOIN user_course ON (filelog.userID=user_course.userID) WHERE fileID='".$this->fileID."' AND filelog.userID!=1 AND user_course.courseID='".$this->courseID."' group BY fileID");
00454                 }
00455                 if ($downCount == "") $downCount = 0;
00456                 $notDownCount = $allCount-$downCount;
00457                 $html .= "<tr><td class='res_file-extra' colspan='5'>";
00458                 $html .= "Anzeigen: &nbsp;&nbsp;";
00459                 // Listet alle Kursteilnehmer aus.. Nach bitte von KQC entfernt
00460                 //$html .= "<a href='".Filemanager::createLink(1,array('show'=>'all'))."'>".($_GET['show']=='all'?"<b><span class="underline">Alle</span></b>":"Alle")." (".$allCount.")</a> | ";
00461                 $html .= "[ <a href='".Filemanager::createLink(1, array('show' => 'down')) ."'>".($_GET['show'] == 'down' ? "Downloader" : "Downloader") ." (".$downCount.")</a> | ";
00462                 $html .= "<a href='".Filemanager::createLink(1, array('show' => 'notDown')) ."'>".($_GET['show'] == 'notDown' ? "Nicht-Downloader" : "Nicht-Downloader") ." (".$notDownCount.")</a> ]";
00463                 $html .= "&nbsp;&nbsp;&nbsp;=> Gesamt: ".$allCount;
00464                 $html .= "<table class='res_statuserlist'><tr><td class='tableCellHead'>Nr.</td><td class='tableCellHead' style='text-align: left;'>Person</td><td class='tableCellHead'>Anzahl</td><td class='tableCellHead' style='text-align: right;'>Letzter Zugriff</td></tr>";
00465                 $count = 0;
00466                 switch ($_GET['show']) { // Was wird angezeigt, down oder not_down
00467 
00468                     case 'down': // Zeigt alle User die dieses File Downgeloadet haben
00469                         $logs = $db->get_results("SELECT DISTINCT userID, date, count(userID) AS klicks FROM filelog WHERE fileID='".$this->fileID."' AND userID!=1 GROUP BY userID ORDER BY userID, date");
00470                         if ($logs) foreach($logs as $log) {
00471                             $user = $db->get_var("SELECT concat(Nachname,', ',Vorname) AS name FROM user WHERE ID='".$log->userID."'");
00472                             if (!isset($user)) continue;
00473                             $data[$user][0] = $log->userID;
00474                             $data[$user][1] = Data::toHTML($user, false);
00475                             $data[$user][2] = $log->date;
00476                             $data[$user][3] = $log->klicks;
00477                         }
00478                         if (!empty($data)) {
00479                             ksort($data); // Array wird nach UserName sortiert
00480                             foreach($data as $value) { //Gibt Namensliste aus
00481                                 $CELL = ($CELL == $CELL1 ? $CELL2 : $CELL1);
00482                                 $userLink = PATH_TO_ROOT."user/homepage.php?user=".$value[0];
00483                                 $html .= "<tr><td class='$CELL'>".++$count."</td><td class='$CELL' style='text-align: left;'><a href='$userLink'>".$value[1]."</a></td><td class='$CELL' >".$value[3]."</td><td class='$CELL' style='text-align: right;'>".Date("d.m.Y H:i", (int)$value[2]) ."</td></tr>";
00484                             }
00485                         }
00486                         break;
00487 
00488                     case 'notDown': // Alle user die es nicht downgeloadet haben
00489                         if ($this->courseID == 0) {
00490                             $users = $db->get_results("SELECT ID, concat(Nachname,', ',Vorname) AS name FROM user WHERE ID!=1 ORDER BY name");
00491                         } else {
00492                             $users = $db->get_results("SELECT ID, concat(Nachname,', ',Vorname) AS name FROM user_course LEFT OUTER JOIN user ON (user_course.userID=user.ID) WHERE ID!=1 AND user_course.courseID='".$this->courseID."' ORDER BY name");
00493                         }
00494                         if ($users) foreach($users as $user) {
00495                             $userLink = PATH_TO_ROOT."user/homepage.php?user=".$user->ID;
00496                             $log = $db->get_var("SELECT DISTINCT count(filelog.userID) AS klicks FROM filelog LEFT JOIN user_course ON (filelog.userID=user_course.userID)  WHERE filelog.userID='".$user->ID."' AND fileID='".$this->fileID."' GROUP BY filelog.userID");
00497                             if ($log != 0) continue;
00498                             $CELL = ($CELL == $CELL1 ? $CELL2 : $CELL1);
00499                             $html .= "<tr><td class='$CELL'>".++$count."</td><td class='$CELL' style='text-align: left;'><a href='$userLink'>".Data::toHTML($user->name, false) ."</a></td><td class='$CELL' >0</td><td class='$CELL' style='text-align: right;'>Nie</td></tr>";
00500                         }
00501                         //$logs = $db->get_results("SELECT concat(Nachname,', ',Vorname) AS name FROM user, user_course WHERE user_course.userID=user.ID AND ID!='".$log->userID."'");
00502                         break;
00503 
00504                     case 'all': // Zeige ALLE User des Kurses an... ZZT DEAKTIVIERT
00505                         if ($this->courseID == 0) {
00506                             $users = $db->get_results("SELECT ID, concat(Vorname,' ',Nachname) AS name FROM user ORDER BY name");
00507                         } else {
00508                             $users = $db->get_results("SELECT ID, concat(Vorname,' ',Nachname) AS name FROM user_course LEFT OUTER JOIN user ON (user_course.userID=user.ID) WHERE user_course.courseID='".$this->courseID."' ORDER BY name");
00509                         }
00510                         if ($users) foreach($users as $user) {
00511                             $CELL = ($CELL == $CELL1 ? $CELL2 : $CELL1);
00512                             $userLink = PATH_TO_ROOT."user/homepage.php?user=".$user->ID;
00513                             $log = $db->get_row("SELECT DISTINCT count(userID) AS klicks, date FROM filelog WHERE userID='".$user->ID."' AND fileID='".$this->fileID."' GROUP BY userID");
00514                             $date = Output::$html .=Date("d.m.Y H:i", (int)$log->date);
00515                             if ($log->date == 0) $date = "Nie";
00516                             if ($log->klicks == 0) $log->klicks = "0";
00517                             $html .= "<tr><td class='$CELL' >".++$count."</td><td class='$CELL' ><a href='$userLink'>".Data::toHTML($user->name, false) ."</a></td><td class='$CELL' >".$log->klicks."</td><td class='$CELL'  style='font-size:10px;text-align:right;' >".$date."</td></tr>";
00518                         }
00519                         break;
00520                     }
00521                     $html .= "</table></td></tr>";
00522                     return $html;
00523 
00524         }

File::getStatisticLink (  )  [private]

Definition at line 396 of file class.file.inc.php.

Referenced by getHTMLString().

00396                                             {
00397         if ($this->type == 'file') {
00398             $LINK = "<a class='file' href='".Filemanager::createLink(0, array("activeFolder" => $this->fileManager->getActiveFolder(), "action" => 'showInfo', 'actionID' => $this->fileID, 'show' => 'down')) ."' title='Dateiname (Studenten heruntergeladen/Gesamt Studenten im Kurs)'>";
00399         } elseif ($this->type == 'link') {
00400             $LINK = "<a class='file' href='".Filemanager::createLink(0, array("activeFolder" => $this->fileManager->getActiveFolder(), "action" => 'showInfo', 'actionID' => $this->fileID, 'show' => 'down')) ."' title='URL: ".Data::toHTML($this->link, false) ."'>";
00401         }
00402         return $LINK;
00403         }

File::getType (  ) 

Definition at line 51 of file class.file.inc.php.

00051                                   {
00052                 return $this->type;
00053         }

File::getUserIcons (  )  [private]

Definition at line 101 of file class.file.inc.php.

References $_SESSION.

Referenced by getHTMLString().

00101                                         {
00102         global $VISIBLE_ICONS;
00103         $imgFolder = $this->fileManager->getImgFolder();
00104         //$EDIT = "<img src='".$imgFolder."edittypes/lock_edit.gif' alt='edit Symbol' />";
00105         //Performance-Tuning: Image wird ab jetzt als CSS-Sprite geladen!
00106         if(isset($_SESSION["UserStyle"]) && $_SESSION["UserStyle"] != "fh_yaml")
00107                 $EDIT = "<img src='".$imgFolder."edittypes/lock_edit.gif' alt='edit Symbol' />";
00108         else $EDIT = "<img src='".PATH_TO_ROOT."images/transparent.gif' class='icon_lock_edit' alt='edit Symbol' />";
00109         //$DELETE = "<img src='".$imgFolder."edittypes/lock_delete.gif' alt='delete Symbol' />";
00110         //Performance-Tuning: Image wird ab jetzt als CSS-Sprite geladen!
00111         if(isset($_SESSION["UserStyle"]) && $_SESSION["UserStyle"] != "fh_yaml")        
00112                 $DELETE = "<img src='".$imgFolder."edittypes/lock_delete.gif' alt='delete Symbol' />";
00113         else $DELETE = "<img src='".PATH_TO_ROOT."images/transparent.gif' class='icon_lock_delete' alt='delete Symbol' />";
00114         $FILEVISIBLE = "";
00115         if ($_SESSION['userid'] == $this->userID || $_SESSION['usergroup'] == ADMIN || ($_SESSION["usergroup"] == DOZENT && $_SESSION["course"] > 0)) {
00116             //$EDIT = "<a title='Dateieigenschaften ver&auml;ndern' href='./edit.php?editID=".$this->fileID."'><img src='".$imgFolder."edittypes/edit.gif' alt='edit Symbol' /></a>";
00117             //Performance-Tuning: Image wird ab jetzt als CSS-Sprite geladen!
00118             if(isset($_SESSION["UserStyle"]) && $_SESSION["UserStyle"] != "fh_yaml")    
00119                 $EDIT = "<a title='Dateieigenschaften ver&auml;ndern' href='./edit.php?editID=".$this->fileID."'><img src='".$imgFolder."edittypes/edit.gif' alt='edit Symbol' /></a>";
00120             else $EDIT = "<a title='Dateieigenschaften ver&auml;ndern' href='./edit.php?editID=".$this->fileID."'><img src='".PATH_TO_ROOT."images/transparent.gif' class='icon_edit_file' alt='edit Symbol' /></a>";
00121             //$DELETE = "<a title='Datei l&ouml;schen' href='".$this->createLink(1, array('action' => "deleteFile", "actionID" => $this->fileID)) ."'><img src='".$imgFolder."edittypes/delete.gif' alt='delete Symbol' /></a>";
00122             //Performance-Tuning: Image wird ab jetzt als CSS-Sprite geladen!
00123             if(isset($_SESSION["UserStyle"]) && $_SESSION["UserStyle"] != "fh_yaml")    
00124                 $DELETE = "<a title='Datei l&ouml;schen' href='".$this->createLink(1, array('action' => "deleteFile", "actionID" => $this->fileID)) ."'><img src='".$imgFolder."edittypes/delete.gif' alt='delete Symbol' /></a>";
00125             else $DELETE = "<a title='Datei l&ouml;schen' href='".$this->createLink(1, array('action' => "deleteFile", "actionID" => $this->fileID)) ."'><img src='".PATH_TO_ROOT."images/transparent.gif' class='icon_delete_file' alt='delete Symbol' /></a>";
00126             //Sichtbarkeitsanzeige für untergeordnete Dateien und Links setzen
00127             $visibleIcon = "";
00128             //beim Laden der Seite
00129             if (isset($this->visibleType) && $this->visibleType >= 1 && $this->visibleType <= 3) {
00130                 $visibleIcon = $VISIBLE_ICONS[$this->visibleType];
00131             }
00132             $FILEVISIBLE = "<a title='Sichtbarkeit &auml;ndern' href='".$this->createLink(1, array('action' => "setRessourceVisibility", "actionID" => $this->fileID)) ."'>".$visibleIcon."</a>";
00133         }
00134         $copyFile = "";
00135         //if ( $this->type == "file" ) $copyFile = "<a title='Datei in anderen Kurs kopieren' href='".$this->createLink(1, array('action' => "copyFile", "actionID" => $this->fileID)) ."'><img src='".$imgFolder."edittypes/copy.png' alt='copy Symbol' /></a>";
00136         //Performance-Tuning: Image wird ab jetzt als CSS-Sprite geladen!
00137         if(isset($_SESSION["UserStyle"]) && $_SESSION["UserStyle"] != "fh_yaml")        
00138                 if ( $this->type == "file" ) $copyFile = "<a title='Datei in anderen Kurs kopieren' href='".$this->createLink(1, array('action' => "copyFile", "actionID" => $this->fileID)) ."'><img src='".$imgFolder."edittypes/copy.png' alt='copy Symbol' /></a>";
00139         else if ( $this->type == "file" ) $copyFile = "<a title='Datei in anderen Kurs kopieren' href='".$this->createLink(1, array('action' => "copyFile", "actionID" => $this->fileID)) ."'><img src='".PATH_TO_ROOT."images/transparent.gif' class='icon_copy_file' alt='copy Symbol' /></a>";
00140         //return "<a title='Dateibeschreibung anzeigen' href='".$this->createLink(1, array('action' => "infoFile", "actionID" => $this->fileID)) ."'><img src='".$imgFolder."edittypes/info.gif' alt='info Symbol' /></a>".$EDIT.$FILEVISIBLE.$DELETE.$copyFile;
00141                 //Performance-Tuning: Image wird ab jetzt als CSS-Sprite geladen!
00142         if(isset($_SESSION["UserStyle"]) && $_SESSION["UserStyle"] != "fh_yaml")        
00143                 return "<a title='Dateibeschreibung anzeigen' href='".$this->createLink(1, array('action' => "infoFile", "actionID" => $this->fileID)) ."'><img src='".$imgFolder."edittypes/info.gif' alt='info Symbol' /></a>".$EDIT.$FILEVISIBLE.$DELETE.$copyFile;
00144         else return "<a title='Dateibeschreibung anzeigen' href='".$this->createLink(1, array('action' => "infoFile", "actionID" => $this->fileID)) ."'><img src='".PATH_TO_ROOT."images/transparent.gif' class='icon_info_file' alt='info Symbol' /></a>".$EDIT.$FILEVISIBLE.$DELETE.$copyFile;
00145         }

File::isFileVisible (  ) 

Definition at line 89 of file class.file.inc.php.

References $_SESSION, and $db.

00089                                         {
00090                 global $db;
00091         if (($_SESSION['usergroup'] == STUDENT || $_SESSION['usergroup'] == ALUMNUS || $_SESSION['usergroup'] == SCHUELER || $_SESSION['usergroup'] == GAST) && $this->visibleType != 1 && $_SESSION['userid'] != $this->userID) {
00092             // Wenn Tutor oder Student und darf nicht sehen spezielle DB abfragen
00093             if (!isset($_SESSION["assistent"]) || (isset($_SESSION["assistent"]) && $this->visibleType == 3 && $_SESSION['userid'] != $this->userID)) {
00094                 $visible = $db->get_var("SELECT count(*) FROM filevisible WHERE userID='".Data::toMysql( $_SESSION['userid'] )."' AND fileID='". Data::toMysql( $this->fileID )."'");
00095                 return ($visible >= 1);
00096             }
00097         }
00098         return true;
00099         }

File::remoteFileExists ( url  )  [private]

Definition at line 190 of file class.file.inc.php.

Referenced by getHTMLString().

00190                                             {
00191         $url_p = parse_url($url);
00192         if (isset($url_p["host"])) {
00193             $host = $url_p["host"];
00194         } else {
00195             return false;
00196         }
00197         $errno = 0;
00198         $errstr = "";
00199         $fp = @fsockopen($host, 80, $errno, $errstr, 5);
00200         if (!$fp) {
00201             return false;
00202         } else {
00203             fputs($fp, "HEAD ".$url." HTTP/1.1\r\n");
00204             fputs($fp, "HOST: ".$host."\r\n");
00205             fputs($fp, "Connection: close\r\n\r\n");
00206             $headers = "";
00207             while (!feof($fp)) {
00208                 $headers.= fgets($fp, 128);
00209             }
00210         }
00211         fclose($fp);
00212         $arr_headers = explode("\n", $headers);
00213         if (isset($arr_headers[0])) {
00214             if (!substr_count($arr_headers[0], "200 OK")) return false;
00215             foreach($arr_headers as $header) {
00216                 $header = strtoupper($header);
00217                 if (substr_count($header, "CONTENT-TYPE:") && substr_count($header, "TEXT/HTML")) return false;
00218             }
00219             return true;
00220         }
00221         return false;
00222     }

File::setCounter ( counter  ) 

Definition at line 63 of file class.file.inc.php.

References $counter.

00063                                                 {
00064                 $this->counter = $counter ;
00065         }

File::setExtension ( extension  ) 

Definition at line 67 of file class.file.inc.php.

References $extension.

00067                                                     {
00068                 $this->extension = $extension ;
00069         }

File::setOrigFileName ( origFileName  ) 

Definition at line 39 of file class.file.inc.php.

References $origFileName.

00039                                                           {
00040                 $this->origFileName = $origFileName;
00041         }

File::setSize ( size  ) 

Definition at line 59 of file class.file.inc.php.

References $size.

00059                                           {
00060                 $this->size = $size;
00061         }

File::setType ( type  ) 

Definition at line 47 of file class.file.inc.php.

References $type.

00047                                           {
00048                 $this->type = $type ;
00049         }


Member Data Documentation

File::$counter [protected]

Definition at line 36 of file class.file.inc.php.

Referenced by setCounter().

File::$extension [protected]

Definition at line 37 of file class.file.inc.php.

Referenced by setExtension().

File::$origFileName [protected]

Definition at line 33 of file class.file.inc.php.

Referenced by setOrigFileName().

File::$size [protected]

Definition at line 35 of file class.file.inc.php.

Referenced by setSize().

File::$type [protected]

Definition at line 34 of file class.file.inc.php.

Referenced by setType().


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Enumerations

Generated on Fri Oct 30 17:21:39 2009 for MSP Modul Ressourcen by  doxygen 1.6.1